package com.douwong.student.model;

import com.douwong.student.enums.E_Code;
import com.douwong.student.enums.E_CommandType;
import com.douwong.student.enums.E_Destination;
import com.douwong.student.enums.E_State;

import java.io.Serializable;
import java.util.UUID;

/**
 * @autor yichao
 * @time 2016/8/269:57
 * @des ${TODO}
 */
public class TcpPacket implements Serializable{
    private static final long serialVersionUID = 1L;
    public TcpPacket(Object data, E_CommandType commandType, E_Destination from, E_Destination to, int senderId, int[] receiveId) {
        this();
        this.from = from;
        this.to = to;
        this.senderId = senderId;
        this.receiveId = receiveId;
        this.data = data;
        this.commandType = commandType;
    }

    public TcpPacket() {
        this.guid = UUID.randomUUID();
    }
    /**
     * 客服端唯一值
     */
    public UUID guid;

    //  UUID.randomUUID();
    /**
     * 从哪里来
     */
    public E_Destination from;
    /**
     * 网络访问的流向
     */
    public E_Destination to;
    /**
     * 发送者id*
     */
    public int senderId;
    /**
     * 接受这id
     * 具体接收者，注：目的地是云端时，没有具体接收者
     */
    public int[] receiveId;
    /**
     * 接受、发送的数据
     */
    public Object data;
    /**
     * 返回编码
     */
    public E_Code code;
    /**
     * 返回错误信息
     */
    public String msg;
    /**
     * 学生端和老师/服务端通信的类型
     */
    public E_CommandType commandType;
    /**
     * 状态码
     */
    public E_State state;

    public UUID getGuid() {
        return guid;
    }

    public void setGuid(UUID guid) {
        this.guid = guid;
    }


    public E_Destination getFrom() {
        return from;
    }
    public void setFrom(E_Destination from) {
        this.from = from;
    }

    public E_Destination getTo() {
        return to;
    }

    public void setTo(E_Destination to) {
        this.to = to;
    }
    public int getSenderId() {
        return senderId;
    }

    public void setSenderId(int senderId) {
        this.senderId = senderId;
    }

    public int[] getReceiveId() {
        return receiveId;
    }

    public void setReceiveId(int[] receiveId) {
        this.receiveId = receiveId;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public E_Code getCode() {
        return code;
    }

    public void setCode(E_Code code) {
        this.code = code;
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public E_CommandType getCommandType() {
        return commandType;
    }

    public void setCommandType(E_CommandType commandType) {
        this.commandType = commandType;
    }

    public E_State getState() {
        return state;
    }

    public void setState(E_State state) {
        this.state = state;
    }
}
